package com.example.ojcommon.enums;

import lombok.Getter;

@Getter
public enum LanguageEnum {
    JAVA("java",  ".java",1),
    C("c",  ".c",2),
    CPP("c++",  ".cpp",3),
    PYTHON("python",  ".py",4),
    GO("golang",  ".go",5);

    private final String text;

    private final Integer value;

    private final String suffix;

    LanguageEnum(String text, String suffix, Integer value) {
        this.text = text;
        this.value = value;
        this.suffix = suffix;
    }

    /**
     * 获取语言
     *
     * @param value
     * @return
     */
    public static LanguageEnum valueOf(Integer value) {
        if (value == null) {
            return null;
        }
        for (LanguageEnum submitLanguageEnum : LanguageEnum.values()) {
            if (submitLanguageEnum.getValue().equals(value)) {
                return submitLanguageEnum;
            }
        }
        return null;
    }
}
